package com.allesblinkt.mucom.common;

/**
 * @author mys
 *
 */
public class Utils {
	
	/**
	 * @return true if JVM runs on systems other than Mac, Linux or Windows
	 */
	public static boolean runsOnOther(){
		if(!runsOnMac() && !runsOnLinux() && !runsOnWindows()) return true;
		return false;
	}
	
	/**
	 * @return true if JVM runs on Mac
	 */
	public static boolean runsOnMac(){
		if(System.getProperty("os.name").startsWith("Mac OS")) return true;
		return false;
	}
	
	/**
	 * @return true if JVM runs on Linux
	 */
	public static boolean runsOnLinux(){
		if(System.getProperty("os.name").startsWith("Linux")) return true;
		return false;
	}
	
	/**
	 * @return true if JVM runs on Windows
	 */
	public static boolean runsOnWindows(){
		if(System.getProperty("os.name").startsWith("Windows")) return true;
		return false;
	}

	/**
	 * @return name of the OS (i.e. Mac OS X)
	 */
	public static String getOs(){
		return  System.getProperty("os.name");
	}
	
	/**
	 * @return name of the user running the JVM
	 */
	public static String getUserName(){
		return System.getProperty("user.name");
	}
	
	
	public static String sanitizeFileName(String theInput){
        String theOutput = theInput.replaceAll("[^\\w\\.\\-\\_]", "_");
        return theOutput;
	}
}
